Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@casual-simulation/aux-common

Package Overview
Dependencies
Maintainers
2
Versions
472
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@casual-simulation/aux-common

Common library for AUX projects

  • 3.3.13
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

AUX Common

npm (scoped)

A library that contains common operations needed to modify and understand AUX files.

Installation

$ npm install @casual-simulation/aux-common

Usage

Calculate a formula for some bots
import {
    createBot,
    createCalculationContext,
    calculateFormulaValue,
} from '@casual-simulation/aux-common';

const file1 = createBot('test1', {
    quantity: 10,
});
const file2 = createBot('test2', {
    quantity: 5,
});
const file3 = createBot('test3', {
    quantity: 5,
});

const context = createCalculationContext([file1, file2, file3]);

const formula = '=math.sum(getBotTagValues("#quantity"))';
const result = calculateFormulaValue(context, formula);

console.log(result);

// Outputs:
// 20
Calculate events for an action script
import {
    createBot,
    createCalculationContext,
    calculateFormulaEvents,
} from '@casual-simulation/aux-common';

const state = {
    test1: createBot('test1', {
        quantity: 10,
    }),
    test2: createBot('test2', {
        quantity: 5,
    }),
    test3: createBot('test3', {
        quantity: 5,
    }),
};

const formula = `
    let total = math.sum(getBotTagValues("#quantity"));
    player.toast("The total is " + total);
`;
const events = calculateFormulaEvents(state, formula);

for (let event of events) {
    if (event.type === 'local') {
        if (event.name === 'show_toast') {
            console.log('[Toast]', event.message);
        }
    }
}

// Outputs:
// [Toast] The total is 5

Keywords

FAQs

Package last updated on 08 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc